<template>
    <div :class="dataInfo.title == active? 'card_item active':!dataInfo.lock?'card_item lock':'card_item'" @click="onActive(dataInfo)">
        <div class="mc" v-if="!dataInfo.lock">
            <img :src="lockImg" alt="" srcset="" style="width: 40px; height: 40px;">
            <span>产品介绍</span>
        </div>
        <div class="content">
            <span>{{dataInfo.title}}</span>
            <img :src="dataInfo.img" alt="" srcset="">
        </div>
    </div>
</template>
<script>
import lockImg from '@/assets/svg/fontApp/lock_icon.svg'
import { mapState, mapActions } from 'vuex';
export default {
    name: '',
    props: ['dataInfo'],
    inject: ['changeActive'],
    data() {
        return {
            lockImg: lockImg
        };
    },
    components: {},
    computed: {
        ...mapState('extend/cardTab', ['active']),
    },
    beforeMount() { },
    mounted() { },
    methods: {
        ...mapActions('extend/cardTab', [
            'changeData'
        ]),
        onActive(event) {
            if (!event.lock) {
                // this.$emit('selectEd', event)
                this.changeData([
                    { key: 'active', value: event.title }
                ])
            }
            this.changeActive("class", event)
        }
    },
    watch: {}
}
</script>
<style lang='less' scoped>
.card_item {
    position: relative;
    user-select: none;
    cursor: pointer;
    width: 264px;
    min-width: 264px;
    height: 160px;
    z-index: 1;
    margin-left: 20px;
    margin-top: 48px;
    transition: all 0.2s ease-in-out;
}
.card_item .content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: url("../../assets/svg/fontApp/card_bg.svg") no-repeat;
    background-size: 100% 100%;
    align-items: center;
}
.card_item .mc {
    position: absolute;
    background: red;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 3;
    background: rgba(228, 238, 251, 0.5);
    border-radius: 8px 8px 0px 0px;
    opacity: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    span {
        text-align: center;
        width: 64px;
        height: 24px;
        line-height: 24px;
        background: #2d8cf0c7;
        box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.04);
        border-radius: 4px 4px 4px 4px;
        opacity: 1;
        color: #ffffff;
        // margin-top: 10px;
    }
}
.card_item:hover {
    transition: all 0.2s ease-in-out;
    margin-top: 24px !important;
}
.lock {
    margin-top: 48px;
}
.active {
    margin-top: 24px !important;
}
.card_item .content span {
    font-size: 16px;
    font-family: PingFang SC-Bold, PingFang SC;
    font-weight: bold;
    color: #f8f8f9;
    margin-top: 6%;
}
.card_item img {
    width: 216px;
    height: 114px;
    border-radius: 0px 0px 0px 0px;
    opacity: 1;
    margin-top: 9px;
}
.card_item:not(:first-child) {
    margin-left: 20px;
}
</style>